package com.yododo.deploy;


import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;

public class YmcDeployWar {
    
    public static void main(String[] args) throws IOException {
        String projectDir = "D:/javaWork/projects/YMC/";
        String destPath = "E:/deploy/";

        // test
        copyFile(new File(projectDir + "ymc-web-api/target/ymc-web-api.war"), new File(destPath + "ymc-web-api.war"));
        copyFile(new File(projectDir + "ymc-console/target/ymc-console.war"), new File(destPath + "ymc-console.war"));
        
        // online
        copyFile(new File(projectDir + "ymc-web-api/target/ymc-web-api-1.0.war"), new File(destPath + "ymc-web-api-1.0.war"));
        copyFile(new File(projectDir + "ymc-console/target/ymc-console-1.0.war"),new File(destPath + "ymc-console-1.0.war"));
        System.out.println("finished");
    }
    
    private static void copyFile(File srcFile, File targetDict) throws IOException {
        if(!srcFile.exists()) {
            return;
        }
        FileUtils.copyFile(srcFile, targetDict);
        System.out.println("copy " + srcFile.getAbsolutePath() + " success.");
    }
    
}
